<?php

/*
 * This class is used for as Model for Product table 
 */

class Model_Propertydescription extends Model_Base {

    protected $_name = 'property_description';
    protected $_primaryKey = 'prd_id';

    public function fetchEntryById($id) {
        $select = $this->select()
                ->from(array('que' => 'property_description'))
                ->where('prd_id = ?', $id);
        // see reasoning in fetchEntries() as to why we return only an array
        $data = $this->fetchRow($select);
        if (!empty($data)) {
            return $data->toArray();
        } else {
            return array();
        }
    }

    public function fetchDescriptionByPropertyId($id) {
        $select = $this->select()
                ->from(array('que' => 'property_description'))
                ->where('prp_id = ?', $id);
        $select->order("prp_lng_id ASC");
        // see reasoning in fetchEntries() as to why we return only an array
        $data = parent::fetchAll($select);
        if (!empty($data)) {

            return $data->toArray();
        } else {
            return array();
        }
    }

}
